<?php
declare (strict_types=1);

namespace app\admin\model;

use think\Model;

/**
 * @mixin \think\Model
 */
class User extends Model
{
    static public function findByPassWord($passWord)
    {
        return self::where('pass_word', $passWord)->find()->toArray();
    }

    static public function regisetered($insertData)
    {
        if (self::findByAccount($insertData['account'])) {
            return ['0', '注册失败用户存在', 0];
        } else {
            return ['1', '注册成功', self::insertGetId($insertData)];
        }
    }

    static public function findByAccount($accoutn)
    {
        return self::where('account', $accoutn)->value('id');
    }
}
